<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="comapnyName" label="公司名" width="180"></el-table-column>
    <el-table-column prop="projectName" label="项目名" width="180"></el-table-column>
    <el-table-column prop="workroomName" label="工作室名"></el-table-column>
    <el-table-column prop="price" label="报价"></el-table-column>
    <el-table-column prop="timeLimit" label="工期"></el-table-column>
    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          type="danger"
          @click="handleDelete(scope.$index, scope.row)">定金尾款</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    data() {
      return {
        tableData: [
          {
            id:'',
            wid:'',
            pid:'',
            cid:'',
            projectName:'',
            comapnyName:'',
            workroomName:'',
            price:'',
            timeLimit:''
          }
        ]
      }
    },
    mounted: function(){
      var user= JSON.parse(window.sessionStorage.getItem("user"));
      var ff=4
      axios.post('/admin/findNopayOrder',{
        id : ff,
        idd:ff
      }).then((response) => {
        if( response.data .states==800){
          this.$notify({
            title: '成功',
            message: '成功',
            type: 'success',
            duration:2000
          });
          var e=response.data.user
          console.log(e)
          var data=[];
          for(var c=0;c<e.length;c++){
            var ee=e[c];
            var obj={}
            obj.id=ee.states
            obj.wid=ee.wid
            obj.pid=ee.pid
            obj.cid=ee.id
            obj.projectName=ee.projectName
            obj.comapnyName=ee.projectDoc
            obj.workroomName=ee.photoUrl
            obj.price=ee.price
            var hh= ee.timeLimit
            var hhh=hh.split("T")
            obj.timeLimit=hhh[0]
            data[c]=obj
            console.log(obj)
          }
          console.log(data)
          this. tableData=data


        }
        else{
          this.$notify({
            title: '失败',
            message: '错误',
            type: 'warning',
            duration:2000
          });
        }
      })

    },
    methods: {
      handleEdit(index, row) {
        console.log(row.id)
        var ff=row.id




      },
      handleDelete(index, row) {
        console.log(index, row);
        var ff=row.id
        axios.post('/admin/orderDjPay',{
          id : ff,
          idd  : ff
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });
            location.reload()
          }
          else{
            this.$notify({
              title: '失败',
              message: '错误',
              type: 'warning',
              duration:2000
            });
          }
        })


      }

    }

  }
</script>



<style scoped>

</style>
